#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : bigDataProject 
@File    : time_control.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/11/10 12:16 
@Describe: 时间工具类
"""
import time
import random
from typing import Text


def get_now_time() -> Text:
    """
    获取当前时间
    :return: 日期格式: 2021-12-11 12:39:25
    """
    localtime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
    return localtime


def now_time_day():
    """
    获取当前时间：年月日
    :return: 日期格式: 2021-12-11
    """
    localtime = time.strftime("%Y-%m-%d", time.localtime())
    return localtime


def get_time_for_min(minute: int) -> int:
    """
    获取几分钟后的时间戳
    @param minute: 分钟
    @return: N分钟后的时间戳
    """
    return int(time.time() + 60 * minute) * 1000


def get_timestamp() -> Text:
    """
    获取当前时间戳, 整形
    @return: 当前时间戳
    """
    return str(int(time.time()) * 1000)


def get_moon_start_time():
    """
    获取本月开始时间
    :return:
    """
    start_time = time.strftime('%Y-%m' + '-01 00:00:00', time.localtime(int(time.time())))
    return start_time


def ice_time(min_time: int = 0, max_time: int = 10):
    """
    生成随机等待时间
    :param min_time: 最小值
    :param max_time: 最大值
    :return:
    """
    random_ice_time = random.randint(min_time, max_time)
    time.sleep(random_ice_time)


if __name__ == '__main__':
    print(get_now_time())
    print(type(get_now_time()))
